At first, I thought Quzah was on to something, that item1: is being treated as a label. But then I wrote this sample program to test it out. Run it and look at the output. It initializes the struct properly.
Code:
#include <stdio.h>
struct mystruct {
int item1, item2, item3, item4, item5, item10; // I think you get the point
} mystruct = {
item1: 1,
item2: 2,
item5: 5,
item4: 4,
};
int main(void)
{
printf("mystruct:\n");
printf("\titem1 %d\n", mystruct.item1);
printf("\titem2 %d\n", mystruct.item2);
printf("\titem3 %d\n", mystruct.item3);
printf("\titem4 %d\n", mystruct.item4);
printf("\titem5 %d\n", mystruct.item5);
printf("\titem10 %d\n", mystruct.item10);
return 0;
}
It compiled with "gcc -Wall main.c" just fine. Then I compiled it with "gcc -Wall -pedantic main.c" and got the following errors
main.c:6: warning: obsolete use of designated initializer with ‘:’
main.c:7: warning: obsolete use of designated initializer with ‘:’
main.c:8: warning: obsolete use of designated initializer with ‘:’
main.c:9: warning: obsolete use of designated initializer with ‘:’
Looks like some outdated syntax.